#pragma once
#include <vector>
#include <list>

namespace wjy
{
	template<class T,class Container=deque<T>>
	class stack
	{
	public:
		bool empty() const
		{
			return _con.empty();
		}
		size_t size() const
		{
			return _con.size();
		}
		const T& front() const
		{
			return _con.front();
		}

		const T& back() const
		{
			return _con.back();
		}
		
		void push(const T& x)
		{
			_con.push_back(x);
		}
		void pop()
		{
			_con.pop_back();
		}
	private:
		Container _con;
	};

	void test_stack1()
	{
		//stack<int, std::vector<int>> s;
		//stack<int, std::list<int>> s;
		stack<int, vector<int>> s;
		s.push(1);
		s.push(2);
		s.push(3);
		s.push(4);

		while (!s.empty())
		{
			cout << s.front() << " ";
			s.pop();
		}
		cout << endl;
	}
}